OtpFieldStyle
Visual style of an OtpField.
Sizes are in points at the default text size and grow with Dynamic Type (scaled with fontTextStyle). minCellWidth and minCellHeight below 44 are raised to 44. focusedBorderWidth must be larger than borderWidth so focus and error are never communicated by color alone. groupSize draws a decorative separator between groups of digits (3 gives "123 - 456") without changing the code; 0 means no grouping. Separators are drawn only when the code length splits into equal groups, so 3 groups a 6-digit code but leaves 4- and 8-digit codes ungrouped. placeholder is drawn in empty cells and is hidden from VoiceOver; null or empty means none. errorTextStyle is the text style of the visible error message. cornerRadius is capped at half the cell size, so a large value (for example .greatestFiniteMagnitude) with equal minCellWidth and minCellHeight gives round cells. glass opts in to an iOS 26 Liquid Glass backdrop behind the cell row; the cells stay solid, so the contrast of digits, borders, focus, and errors is unchanged. Earlier iOS versions draw no backdrop. Use withGlass to turn it on. liftFocusedCell raises the focused cell slightly with a shadow, in addition to its thicker border; the movement is skipped under Reduce Motion. Use withFocusLift to turn it off. Create instances with OtpFieldDefaults.style.
Properties
Contrast problems of colors for the current trait collection; empty when compliant.
Minimum cell height in points at the default text size, never below 44.
Minimum cell width in points at the default text size, never below 44.
Glyph drawn in empty cells, or null.
Functions
Copy with cornerRadius; a value of at least half the cell size gives round cells.
Copy with the focused cell lift on or off.
Copy with the Liquid Glass backdrop on or off.
Copy with groupSize; see OtpFieldStyle for when separators are drawn.